Skip to main content

Customizing chart settings

This page explains how to configure available and default chart settings in the DXcharts Android SDK.

You can perform the following actions:

  • Choose which settings are visible in the chart UI (setAvailableSettingsItems).

  • Define initial values for chart configuration (setDefaultConfiguration).

  • Set which settings are disabled by default (setDefaultDisabledItems).

Managing available settings

Use setAvailableSettingsItems to define which settings appear in the UI:

settingsRepository.setAvailableSettingsItems(
listOf(
SettingsScreenItem.HIGH_AND_LOW,
SettingsScreenItem.TIMEZONE,
SettingsScreenItem.THEME,
SettingsScreenItem.TRADING_FROM_CHART,
SettingsScreenItem.SHOW_ACTIVE_ORDERS
)
)

To exclude a specific setting:

settingsRepository.setAvailableSettingsItems(
SettingsScreenItem.entries.filterNot {
it == SettingsScreenItem.NEWS
}
)

To exclude an entire group of settings:

settingsRepository.setAvailableSettingsItems(
SettingsScreenItem.entries.filterNot {
it.submenu == SettingsScreenItem.SettingsSubmenu.EVENTS
}
)

Note: Hiding a setting or group only removes it from the UI. The setting remains active unless disabled via setDefaultConfiguration.

Setting the default configuration

The SDK provides a DEFAULT chart configuration:

val DEFAULT = ChartConfigurationData(
general = General(
chartType = ChartType.CANDLE,
highAndLow = false,
verticalGrid = true,
horizontalGrid = false,
candleWicks = true,
watermark = false,
timezone = Timezones.Exchange
),
colors = Colors(
theme = Theme.AUTO,
bullish = Color(0xFF67AD6D),
bearish = Color(0xFFEB4C4C),
doji = Color(0xFF000000),
bullishBorder = Color(0xFF67AD6D),
bearishBorder = Color(0xFFEB4C4C),
area = Color(0xFF7F78D6),
scatter = Color(0xFF000000),
volumeBullish = Color(0xFF67AD6D),
volumeBearish = Color(0xFFEB4C4C),
volumeDoji = Color(0xFF000000),
background = Color(0xFFFFFFFF),
watermark = Color(0x1A000000),
grid = Color(0xFFE5E5E5),
valuesOnScales = Color(0xFFD1D1D1),
highLowValues = Color(0xFF000000),
paneResizer = Color(0xFFE5E5E5),
crosstool = Color(0xFFFF5B24),
drawingsText = Color(0xFFFF5B24)
),
trading = Trading(
tradingFromChart = false,
showActiveOrders = true,
showOpenPositions = true,
),
scales = Scales(
autoScale = true,
fitStudies = true,
fitOrders = false,
fitPositions = false,
invertScale = false,
lockScale = false,
scaleType = ScaleType.REGULAR,
),
data = Data(
sessionBreaks = false,
extendedHours = false,
alignDataWithSessionStart = false,
priceType = PriceType.LAST,
volume = true,
),
events = Events(
eventsOnChart = false,
dividends = true,
splitsAndConsolidations = true,
earningsAndEstimates = true,
conferenceCalls = true,
news = true,
),
unchangeableColors = UnchangeableColors(
highlights = Highlights(
afterMarket = Highlights.Highlight("", "", ""),
preMarket = Highlights.Highlight("", "", ""),
regular = Highlights.Highlight("", "", ""),
noTrading = Highlights.Highlight("", "", ""),
)
)
)

To override default settings, you can either create and pass your own ChartConfigurationData, or copy and update the default configuration as needed:

settingsRepository.setDefaultConfiguration(
ChartConfigurationData.DEFAULT.copy(
general = ChartConfigurationData.DEFAULT.general.copy(watermark = true),
data = ChartConfigurationData.DEFAULT.data.copy(volume = false)
)
)

Disabling settings by default

To define which settings are turned off by default, use:

settingsRepository.getDefaultDisabledItems()
settingsRepository.setDefaultDisabledItems(
listOf(
SettingsScreenItem.SHOW_ACTIVE_ORDERS,
SettingsScreenItem.SHOW_OPEN_POSITIONS
)
)

SDK default disabled settings

The SDK disables the following settings by default:

SettingsScreenItem.SHOW_ACTIVE_ORDERS
SettingsScreenItem.SHOW_OPEN_POSITIONS
SettingsScreenItem.DIVIDENDS
SettingsScreenItem.SPLITS_AND_CONSOLIDATIONS
SettingsScreenItem.EARNINGS_AND_ESTIMATES
SettingsScreenItem.CONFERENCE_CALLS
SettingsScreenItem.NEWS

Linked dependencies

Some settings depend on others and are automatically enabled or disabled based on their state.

Trading settings:

SettingsScreenItem.SHOW_ACTIVE_ORDERS and SettingsScreenItem.SHOW_OPEN_POSITIONS depend on TRADING_FROM_CHART:

  • If TRADING_FROM_CHART is true, both are enabled.
  • If TRADING_FROM_CHART is false, both are disabled unless explicitly enabled by the user.

Events settings

The following items depend on EVENTS_ON_CHART:

  • SettingsScreenItem.DIVIDENDS

  • SettingsScreenItem.SPLITS_AND_CONSOLIDATIONS

  • SettingsScreenItem.EARNINGS_AND_ESTIMATES

  • SettingsScreenItem.CONFERENCE_CALLS

  • SettingsScreenItem.NEWS

  • If EVENTS_ON_CHART is true, all become enabled.

  • If EVENTS_ON_CHART is false, all remain disabled unless explicitly enabled by the user.